#include <stdio.h>

double fact( int n );
double factsum( int n );

int main()
{
    int n;

    scanf("%d",&n);
    printf("fact(%d) = %.0f\n", n, fact(n));
    printf("sum = %.0f\n", factsum(n));

    return 0;
}

/* 你的代码将被嵌在这里 */

double fact ( int n ) {
    double fac = 1;
    if ( n < 1 ) {
        
    } else if ( n > 1 ) {
        fac = n * fact(n-1);
    } else {
        fac = 1;
    }
    return fac;
}

double factsum ( int n ) {
    double facs = 0;
    if ( n < 1 ) {
      facs = 0;  
    } else if ( n > 1 ) {
        facs = fact(n) + factsum(n-1);
    } else {
        facs = 1;
    }
    return facs;
}